package tool.plot

import java.io.File

import implicits.Implicits._
import shared.Pojo._
import tool.Pojo._
import tool.Tool
import tool.plot.AllPlot.RPlotB


/**
 * Created by yz on 27/9/2020
 */
object GroupBar extends GroupBarT with RPlotB {

  def producePlotConfigFile(data: AllPlotData, workspaceDir: File, extraData: ExtraDataData) = {
    Tool.dataCoverConfigFile(data, workspaceDir, configFileName, configJsonFileName)
  }

  override def getCommand(data:AllPlotData,extraData: ExtraDataData): String = {
    s"""
       |${"Rscript".condaPath()} ${new File(Tool.rPath, "meta_relative_abundance_sum_plot.R").unixPath}
       |convert  -density 300 Class_Barplot_by_Group.pdf  Class_Barplot_by_Group.png
       |""".stripMargin
  }

  override def defaultPlotArg(tmpPlotData: AllPlotData): AllPlotData = {
    tmpPlotData.copy(
      layout = tmpPlotData.layout.copy(
        width = "0",
        height = "5",
      ),
      xFont = "14",
      yFont = "15",
      yTitleFont = "15",
      mainTitle = "",
      mainTitleFont = "13",
      legendFont = "8",
      legendTitle = "",
      legendTitleFont = "11",
    )
  }

}

